﻿package com.musicrun.midi
{
	public class Note extends Object
	{
		public static const DEFAULT_DURATION:int = 10;
		
		private var tOn:int;
		private var tOff:int;
		
		private var noteNumber:int;
		private var velocity:int;
		
		public function Note(tOn:int, noteNumber:int, velocity:int) {
			this.tOn = tOn;
			this.tOff = tOn + DEFAULT_DURATION;
			
			this.noteNumber = noteNumber;
			this.velocity = velocity;
		}
		
		public function setTimeOfNoteOff(tOff:int) {
			this.tOff = tOff;
		}
		
		public function getTimeOfNoteOn():int {
			return this.tOn;
		}
		
		public function getTimeOfNoteOff():int {
			return this.tOff;
		}
		
		public function getNoteNumber():int {
			return noteNumber;
		}
		
		public function toString():String {
			return "Note: " + noteNumber + ", velocity: " + velocity + ", on = " + tOn + ", off = " + tOff;
		}
	}
}